home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Essentials / Technical.Notes / IIGS / TN.IIGS.077 < prev    next >
Encoding:
Text File  |  1990-01-09  |  12.3 KB  |  238 lines  |  [TEXT/pdos]

  1. Apple II
  2. Technical Notes
  3. _____________________________________________________________________________
  4.                                                   Developer Technical Support
  5.  
  6.  
  7. Apple IIGS
  8. #77:    Print Manager & AppleTalk Configuration Files
  9.  
  10. Written by:    Jim Luther                                        January 1990
  11.  
  12. This Technical Note describes the Print Manager user configuration file 
  13. Printer.Setup and the AppleTalk user configuration file ATInit.  This Note 
  14. also describes a limitation of the Print Manager call PrGetUserName, which is 
  15. a result of the way configuration information is stored in the Printer.Setup 
  16. file.
  17. _____________________________________________________________________________
  18.  
  19.  
  20. Printer.Setup and ATInit
  21.  
  22. What Are the Printer.Setup and ATInit Files?
  23.  
  24. The Print Manager user configuration file Printer.Setup, which is found in the 
  25. System:Drivers directory of the Apple IIGS boot disk, is used by the Print 
  26. Manager tool set to keep the name of the printer driver and port driver you've 
  27. selected between system boots.  In addition, if you've selected a network 
  28. printer, Printer.Setup contains the selected printer's network address and 
  29. your machine's User Name.  The file format of Printer.Setup has not been 
  30. published because revisions have been made, and may be made again, to the 
  31. Apple IIGS System Software, which can change Printer.Setup's file format.
  32.  
  33. The AppleTalk user configuration file ATInit, which is found in the 
  34. System:System.Setup directory of the Apple IIGS boot disk, is used to keep the 
  35. default AppleShare startup application, the default AppleShare prefix, the 
  36. default AppleTalk User Name, and the default AppleTalk printer entity name 
  37. (the network printer entity used by AppleTalk's Remote Print Manager) between 
  38. system boots.  The file format of the ATInit file was published incorrectly in 
  39. the AppleShare Programmer's Guide for the Apple IIGS.  The correct file format 
  40. for ATInit will be discussed later in this Note.
  41.  
  42. It is important to remember that the Print Manager tool set uses the 
  43. information from the Printer.Setup file only, and that AppleTalk and 
  44. AppleShare use the information contained in the ATInit file only.  It is also 
  45. important to note that the Print Manger tool set, which is used to print 
  46. QuickDraw II graphics, and AppleTalk's Remote Print Manager (RPM), which is 
  47. used to print ASCII data to network printers, are not the same thing even 
  48. though both contain the words "Print Manager."
  49.  
  50. What Writes to the Printer.Setup and ATInit Files?
  51.  
  52. Before Apple IIGS System Software 5.0, Printer.Setup and ATInit were handled 
  53. as completely separate configuration files.  The Print Manager call 
  54. PrChoosePrinter allowed you to select the printer and port drivers the Print 
  55. Manager would use and wrote the printer and port driver selections to the 
  56. Printer.Setup file.  The AppleTalk application Chooser.II let you select the 
  57. printer AppleTalk's Remote Print Manager would use and wrote the printer 
  58. entity selection to the ATInit file.
  59.  
  60. With System Software 5.0 all printer selections for both the Print Manager 
  61. and AppleTalk are made by using one of the Control Panel NDA's printer CDevs.  
  62. All printer CDevs (e.g., DirectConnect, ATIWriter, ATLQIWriter, and ATLWriter) 
  63. write the new printer and port driver selections to the Printer.Setup file.  
  64. However, if the printer selected uses the AppleTalk port (i.e., the selection 
  65. is made with the ATIWriter, ATLQIWriter, or ATLWriter printer CDevs), then the 
  66. selected printer's network address and your User Name are written to both the 
  67. Printer.Setup and the ATInit files.  The DirectConnect CDev does not write any 
  68. information to the ATInit file.  If AppleShare is installed, then the 
  69. AppleShare CDev will also write your User Name to the ATInit file.
  70.  
  71. On AppleShare file servers with the Apple II Setup option installed, the 
  72. ATInit file in User folders will also be written to by the AppleShare Admin 
  73. application when the Apple II startup information is set.
  74.  
  75. When are the Printer.Setup and ATInit Files Read?
  76.  
  77. The Printer.Setup file is read by the Print Manager and by the printer CDevs.  
  78. The Print Manager reads the information contained in the Printer.Setup file 
  79. whenever the Print Manager needs to load a printer driver or a port driver 
  80. into memory.  A printer CDev reads the information contained in the 
  81. Printer.Setup file when that CDev is selected so it can know the current 
  82. printer and port selections.
  83.  
  84. Ways the printer driver and the port driver might be unloaded and need to be 
  85. loaded (which will cause Printer.Setup to be read by the Print Manager) are as 
  86. follows:
  87.  
  88.   o  The Print Manager is shut down.
  89.  
  90.   o  The current printer driver or port driver is changed with a 
  91.      Control Panel printer CDev.  When a new printer or port is 
  92.      selected with a printer CDev, the current drivers are unloaded 
  93.      from memory so the Print Manager will be forced to read the new 
  94.      printer and port selections from Printer.Setup.
  95.  
  96.   o  Your application makes the PMUnloadDriver Print Manager call.
  97.  
  98. An application can load one or both of the drivers (which will cause 
  99. Printer.Setup to be read by the Print Manager) by making the PMLoadDriver 
  100. call.  The AppleTalk user configuration information contained in the ATInit 
  101. file is read during system startup as part of AppleTalk's initialization.
  102.  
  103.  
  104. Network Booting and Printer.Setup
  105.  
  106. When Apple IIGS computers are booted over an AppleShare network, they all 
  107. share a single copy of the Printer.Setup file.  That means all machines must 
  108. use the same printer and port driver selections that are stored in the 
  109. Printer.Setup file.  If all machines are expected to be able to print using 
  110. the Print Manager tool set, then the printer and port selection stored in 
  111. Printer.Setup must be something that all can use.  The only two options are:
  112.  
  113.   o  A single shared network printer for all machines (i.e., a 
  114.      LaserWriter, an AppleTalk ImageWriter, or an AppleTalk ImageWriter 
  115.      LQ).  In situations where many machines are booted over a single 
  116.      file server, this may cause the workload on the single shared 
  117.      printer to be unacceptable.
  118.  
  119.   o  A direct-connect printer on each machine.  The limitations of this 
  120.      solution are that the printers must be of the same type (all 
  121.      ImageWriters, all ImageWriter LQs, or all Epsons) and all machines 
  122.      must use the same printer port (either printer or modem).
  123.  
  124. The server administrator should set the default printer selection, which will 
  125. be used by all machines, by using one of the Control Panel NDA's printer 
  126. CDevs.  Then, the access privileges to the server's System:Drivers directory 
  127. should be set to "Bulletin Board" (i.e., Everyone See Folders, Everyone See 
  128. Files, Owner Make Changes) so other machines cannot change the printer and 
  129. port selection.
  130.  
  131.  
  132. Using User Names
  133.  
  134. The User Name We Use
  135.  
  136. You may have noticed that you see your AppleTalk User Name in the Control 
  137. Panel's AppleShare and printer CDevs.  AppleShare allows a machine's User Name 
  138. to be up to 31 characters long.  The CDevs read the User Name from the ATInit 
  139. file.  The AppleShare and printer CDevs also store the complete User Name back 
  140. into the ATInit file.
  141.  
  142. PrGetUserName (Almost)
  143.  
  144. The Printer.Setup file sets aside 15 characters for the User Name so the 
  145. printer CDevs store only the first 15 characters of the User Name in the 
  146. Printer.Setup file.  This limitation is leftover from early Print Manager 
  147. implementations of the PrChoosePrinter call, which limited the User Name 
  148. length to 15 characters.
  149.  
  150. Since the Print Manager gets the User Name it uses from the Printer.Setup 
  151. file, the User Name returned by the Print Manager call PrGetUserName will be 
  152. truncated to 15 characters if the complete AppleTalk User Name is 16 
  153. characters or longer.
  154.  
  155. Where to Get the Complete User Name
  156.  
  157. If your application needs the complete default AppleTalk User Name, it can be 
  158. read from the ATInit file.  When an Apple IIGS is booted from a local disk 
  159. volume that has AppleShare or at least one of the AppleTalk network printers 
  160. installed, ATInit will be found in the System:System.Setup directory of the 
  161. local boot volume.  When an Apple IIGS is booted over AppleTalk, ATInit will 
  162. be found in the Users:YourName:Setup directory of the AppleShare boot volume 
  163. (where YourName is the User Name used to log on to the boot server).
  164.  
  165.  
  166. The ATInit File Format
  167.  
  168. The AppleShare Programmer's Guide for the Apple IIGS shows the file format of 
  169. the ATInit file as it is stored on an AppleShare boot volume.  However, the 
  170. file format of ATInit is not always as shown in that manual.  In all cases, 
  171. ATInit will contain the three required data fields UserName, PrinterFlags, and 
  172. PrinterTuple at the end of the file.  Before those data fields, ATInit may 
  173. also contain executable code or additional data fields.  Since the three 
  174. required data fields are directly before ATInit's end-of-file (EOF), you can 
  175. find them relative to ATInit's EOF using the displacements listed in Table 1.
  176.  
  177. Displacement to
  178. ATInit EOF          Size      Field Name    Description
  179. _____________________________________________________________________________
  180. 133                 33 Bytes  UserName      A Pascal-type string containing 
  181.                                             the default User Name.  It 
  182.                                             consists of a length byte 
  183.                                             followed by up to 31 bytes of 
  184.                                             ASCII data and a single, unused 
  185.                                             byte.  This field is always 33 
  186.                                             bytes long.
  187. 100                 Byte      PrinterFlags  This is the Flags field used by 
  188.                                             the Remote Print Manager's 
  189.                                             default network printer.
  190. 99                  99 Bytes  PrinterTuple  This field specifies the name of 
  191.                                             the default network printer used 
  192.                                             by the Remote Print Manager.  The 
  193.                                             PrinterTuple field is in standard 
  194.                                             Name Binding Protocol (NBP) 
  195.                                             format.  This field is always 99 
  196.                                             bytes long.
  197. _____________________________________________________________________________
  198.  
  199.                   Table 1-Offsets of Required Data Fields
  200.  
  201. If the ATInit file is on an AppleShare server, it will have 6 additional data 
  202. fields (PathVolID, PathDirID, Path, PrefixVolID, PrefixDirID, and Prefix) 
  203. directly before the three required data fields.  These fields can also be 
  204. found relative to ATInit's EOF using the displacements listed in Table 2.
  205.  
  206. Displacement to
  207. ATInit EOF          Size      Field Name    Description
  208. _____________________________________________________________________________
  209. 275                 Word      PathVolID     The Volume ID number of the 
  210.                                             user's AppleTalk startup 
  211.                                             application.
  212. 273                 Long      PathDirID     The Directory ID number of the 
  213.                                             user's AppleTalk startup 
  214.                                             application.
  215. 269                 65 Bytes  Path          The Pathname of the user's 
  216.                                             AppleTalk startup application.
  217. 204                 Word      PrefixVolID   The Volume ID number of the 
  218.                                             user's AppleTalk default prefix.
  219. 202                 Long      PrefixDirID   The Directory ID number of the 
  220.                                             user's AppleTalk default prefix.
  221. 198                 65 Bytes  Prefix        The user's AppleTalk default 
  222.                                             prefix.
  223. _____________________________________________________________________________
  224.  
  225.                   Table 2-Offsets of Optional Data Fields
  226.  
  227. The displacements in Tables 1 and 2 can be used with the GS/OS SetMark call to 
  228. move the file mark to the beginning of any of the above fields.  The SetMark 
  229. call's base field should be set to $0001 so the mark will be set equal to EOF 
  230. minus the displacement.
  231.  
  232.  
  233. Further Reference
  234. _____________________________________________________________________________
  235.   o  Apple IIGS Toolbox Reference
  236.   o  Inside AppleTalk
  237.   o  AppleShare Programmer's Guide for the Apple IIGS
  238.